package com.example.vue20220402.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.vue20220402.pojo.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper extends BaseMapper<Role> {

    @Select("select GROUP_CONCAT(p.power_name) powersname,r.role_id,r.role_name  from role r left join rolepower rp on r.role_id = rp.role_id LEFT JOIN power p on p.power_id = rp.power_id GROUP BY r.role_id ,r.role_name")
    List<Role> rolelist(Role role);

    @Delete("delete from rolepower where role_id = #{roleId}")
    void deleteRolePowerByRoleId(Integer roleId);

    void addRolePowers(List<Integer> list,Integer roleId);
}
